using System.Buffers;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.VFX;

public class UpgradeHotBullet:Upgrade {

	protected override void AmmoConsumptionDecidingEventHandler(object _sender,ShootEventArgs e) {
		if(!weapon.owner.buffs.ContainsKey(typeof(BuffIgnited))) return;
		base.AmmoConsumptionDecidingEventHandler(_sender,e);
	}

	protected override void ProjectileFiringEventHandler(object _sender,ProjectileEventArgs e) {
		base.ProjectileFiringEventHandler(_sender,e);
		if(!weapon.owner.buffs.ContainsKey(typeof(BuffIgnited))) return;
		Projectile sender = _sender as Projectile;
		ModifierApplyStatusEffect newModifier = new ModifierApplyStatusEffect(sender,new string[0]);
		newModifier.buffType=typeof(BuffIgnited);
		newModifier.amountPerDamage=Mathf.Max(0.1f,weapon.owner.buffs[typeof(BuffIgnited)].stacks*0.05f);
		newModifier.amount=Mathf.Max(0.25f,weapon.owner.buffs[typeof(BuffIgnited)].stacks*0.5f);

		sender.AddModifier(newModifier);

		VisualEffect vfx = ParticleManager.Create("CharacterFire",sender.transform.position).GetComponent<VisualEffect>();
		vfx.transform.parent=sender.transform;
		vfx.SetFloat("Intensity",weapon.owner.buffs[typeof(BuffIgnited)].stacks+2);
		vfx.SetVector2("Size",new Vector2(0.2f,0.2f));
	}

}